<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改主持人')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" >
	<form class="form-horizontal m" id="form-host-edit" th:object="${host}">
		<input id="postId" name="postId" type="hidden" th:field="*{hostId}"/>
		<div class="form-group">
			<label class="col-sm-3 control-label">姓名：</label>
			<div class="col-sm-8">
				<div style="height: 34px;line-height: 34px;" th:text="${host.hostName}"></div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label ">星推荐：</label>
			<div class="col-sm-8">
				<input type="radio" name="hostRecommend" th:checked="${host.hostRecommend}==0"  value="0"/>不推荐
				<input type="radio" name="hostRecommend" th:checked="${host.hostRecommend}==1" value="1"/>推荐
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">星推荐有效期：</label>
			<div class="col-sm-8">
				<div>
					<input type="text" class="time-input" style="width: 100px; display: inline;" placeholder="开始时间" th:value="${#dates.format(host.recommentValidStart,'yyyy-MM-dd')}" name="recommentValidStart"/>
					<span>-</span>
					<input type="text" class="time-input" style="width: 100px; display: inline;" th:value="${#dates.format(host.recommentValidStop,'yyyy-MM-dd')}"  name="recommentValidStop"/>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label ">自添订单：</label>
			<div class="col-sm-8">
				<input type="radio" name="selfOrder"   value="1" th:checked="${host.selfOrder}==1"/>允许
				<input type="radio" name="selfOrder"  value="0" th:checked="${host.selfOrder}==0"/>不允许
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">星推荐时间：</label>
			<div class="col-sm-8">
				<div>
					<input type="text" id="dayValidStart" th:value="${#dates.format(host.dayValidStart,'HH:mm:ss')}" style="width: 100px; display: inline;" name="dayValidStart" placeholder="hh:mm:ss"/>
					<span>-</span>
					<input type="text" id="dayValidStop" th:value="${#dates.format(host.dayValidStop,'HH:mm:ss')}" style="width: 100px; display: inline;" name="dayValidStop" placeholder="hh:mm:ss"/>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">折扣</label>
			<div class="col-sm-8">
				<input name="discount"  class="form-control" type="text" maxlength="30" required th:value="${host.discount}"/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">折扣有效时间：</label>
			<div class="col-sm-8">
				<div>
					<input type="text" id="discountStart" th:value="${#dates.format(host.discountStart,'yyyy-MM-dd HH:mm:ss')}" style="width: 200px; display: inline;" name="discountStart" />
					<span>-</span>
					<input type="text" id="discountStop" th:value="${#dates.format(host.discountStop,'yyyy-MM-dd HH:mm:ss')}" style="width: 200px; display: inline;" name="discountStop"/>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">价格</label>
			<div class="col-sm-8">
				<input name="hostPrice" class="form-control" type="text" maxlength="30" required th:value="${host.hostPrice}" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">管理费</label>
			<div class="col-sm-8">
				<input name="hostCostMoney" class="form-control" type="text" maxlength="30" required th:value="${host.hostCostMoney}"/>
			</div>
		</div>
		<!--			<div class="form-group">-->
		<!--				<label class="col-sm-3 control-label">岗位状态：</label>-->
		<!--				<div class="col-sm-8">-->
		<!--				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">-->
		<!--						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
		<!--						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
		<!--					</div>-->
		<!--				</div>-->
		<!--			</div>-->
	</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
	var prefix = ctx + "user/host";

	$("#form-host-edit").validate({
		onkeyup: false,
		rules:{
			hostPhone:{
				remote: {
					url: prefix +"/checkPhone",
					type: "post",
					dataType: "json",
					data: {
						"hostPhone" : function() {
							return $.common.trim($("#hostPhone").val());
						}
					},
					dataFilter: function(data, type) {
						return $.validate.unique(data);
					}
				}
			},
			hostEmail:{
				remote: {
					url: prefix +"/checkEmail",
					type: "post",
					dataType: "json",
					data: {
						"hostEmail" : function() {
							return $.common.trim($("#hostEmail").val());
						}
					},
					dataFilter: function(data, type) {
						return $.validate.unique(data);
					}
				}
			},
			postSort:{
				digits:true
			},
		},
		messages: {
			"hostPhone": {
				remote: "手机号已经存在"
			},
			"hostEmail": {
				remote: "邮箱已经存在"
			}
		},
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/perset", $('#form-host-edit').serialize());
		}
	}

	layui.use('laydate', function(){
		var laydate = layui.laydate;

		laydate.render({
			elem: '#dayValidStart',
			type: 'time',
			trigger: 'click'
		});

		laydate.render({
			elem: '#dayValidStop',
			type: 'time',
			trigger: 'click'
		});

		laydate.render({
			elem: '#discountStart',
			type: 'datetime',
			trigger: 'click'
		});

		laydate.render({
			elem: '#discountStop',
			type: 'datetime',
			trigger: 'click'
		});

	});
</script>
</body>
</html>
